home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / STDLIB.PAK / EQUAL.CPP < prev    next >
Text File  |  1997-05-06  |  552b  |  26 lines

  1.  #include <algorithm>
  2.  #include <vector>
  3.  
  4.  using namespace std;
  5.  
  6.  int main ()
  7.  {
  8.    int d1[4] = {1,2,3,4};
  9.    int d2[4] = {1,2,4,3};
  10.    //
  11.    // Set up two vectors.
  12.    //
  13.    vector<int> v1(d1+0, d1+4), v2(d2+0, d2+4);
  14.    //
  15.    // Check for equality.
  16.    //
  17.    bool b1 = equal(v1.begin(), v1.end(), v2.begin());
  18.    bool b2 = equal(v1.begin(), v1.end(), v2.begin(),equal_to<int>());
  19.    //
  20.    // Both b1 and b2 are false.
  21.    //
  22.    cout << (b1 ? "TRUE" : "FALSE")  << " "
  23.         << (b2 ? "TRUE" : "FALSE") << endl;
  24.    return 0;
  25.  }
  26.